<?php
namespace Admin\Controller;
use Think\Controller;
class TestController extends BaseController {
	
    public function index(){
            
            $admin=M();
            $content=I('get.content');
            //preg_match("/\/(.*)/", $content, $arr);
            //preg_match("/(.*)\//", $content, $name);
            
            if($content=='测试不通过'){
                $content=3;
            }elseif($content=='测试通过'){
                $content=4;
            }elseif($content=='提交反馈'){
                $content=1;
            }else{
                $content=$content;
            }
            $test_admin=$admin->table('sdk_app B')->join('dev_base_package A ON B.app_id=A.app_id')->where("app_name='".$content."'OR status='".$content."'")->select();
             if(!$test_admin){   
                //echo "<script>alert('无符合条目');</script>"; 
                $test_admin=$admin->table('sdk_app B')->join('dev_base_package A ON B.app_id=A.app_id')->select();        
            }
            //$test_admin=$admin->table('dev_base_package')->select();
            
            if($_SESSION['power']==1){
                $sdk_node=$admin->table('ymn_node')->where('level=1')->select();
            }else{
                $sdk_node=$admin->table('ymn_node')->select();
            }
           
            
            //$app_admin['0']['username']= 1;
            

           
            
            $this->assign('sdk_node',$sdk_node);
            $this->assign('test_admin',$test_admin);
            
            $this->display();
        
        
    }
    
     public function response(){
        
        $id=I('post.id');
        $info['report']=I('post.intro');
        $info['status']=I('post.state');
        $info['submit_at']=strtotime("now");
        var_dump($id);
        $admin=M();
        
        $result=$admin->table('dev_base_package')->where("id='".$id."'")->save($info); 
        
        if($result){
            echo "提交成功";
        }else{
            echo "提交失败";
        }

    }
   
}
   
